package com.kushe.entity;

import com.kushe.util.core.DbUtils;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.One;
import org.nutz.dao.entity.annotation.Table;

import java.util.Date;

/**
 * Created by WhiteBlue on 15/5/2.
 */

@Table("ks_post")
public class Post {

    @Id
    private int id;

    @Column
    private int user_id;


    @Column
    private String content;

    @Column
    private int design_id;

    @Column
    private Date time;

    @One(target = User.class, field = "user_id")
    private User user;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }


    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getDesign_id() {
        return design_id;
    }

    public void setDesign_id(int design_id) {
        this.design_id = design_id;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public User getUser() {
        if (this.user == null) {
            DbUtils.getNutzDao().fetchLinks(this, "user");
            return this.user;
        } else
            return this.user;
    }


    public void setUser(User user) {
        this.user = user;
    }
}
